home *** CD-ROM | disk | FTP | other *** search
/ IRIS Performer 2.2 Friends Demo / SGI IRIS Performer 2.2 Friends Demo.iso / friends / coryphaeus / dwb_writer / pfdwb.h < prev    next >
C/C++ Source or Header  |  1997-10-31  |  45KB  |  1,494 lines

  1. /*
  2.  * Copyright (C) Coryphaeus Software, Inc. 1994
  3.  *
  4.  *   DWB Loader for Performer 2.0
  5.  *
  6.  */
  7.  
  8. #ifndef __PFDWB_H__
  9. #define __PFDWB_H__
  10.  
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14.  
  15.  
  16. /* 
  17.  * Texture environment 
  18.  */
  19.  
  20. #define DWB_TV_MODULATE             0x101
  21. #define DWB_TV_BLEND                0x102
  22. #define DWB_TV_DECAL                0x103
  23. #define DWB_TV_COLOR                0x200
  24. #define DWB_TV_SHADOW               0x104
  25. #define DWB_TV_ALPHA                0x105
  26. #define DWB_TV_COMPONENT_SELECT     0x300
  27. #define DWB_TV_I_GETS_R             0x310
  28. #define DWB_TV_I_GETS_G             0x320
  29. #define DWB_TV_I_GETS_B             0x330
  30. #define DWB_TV_I_GETS_A             0x340
  31. #define DWB_TV_IA_GETS_RG           0x350
  32. #define DWB_TV_IA_GETS_BA           0x360
  33. #define DWB_TV_I_GETS_I             0x370
  34. #define DWB_TV_NULL                 0x000
  35.  
  36. /*
  37.  * Texture filters
  38.  */
  39.  
  40. #define DWB_TX_POINT                0x110
  41. #define DWB_TX_BILINEAR             0x220
  42. #define DWB_TX_MIPMAP               0x120
  43. #define DWB_TX_MIPMAP_POINT         0x121
  44. #define DWB_TX_MIPMAP_LINEAR        0x122
  45. #define DWB_TX_MIPMAP_BILINEAR      0x123
  46. #define DWB_TX_MIPMAP_TRILINEAR     0x124
  47. #define DWB_TX_BICUBIC                      0x230
  48. #define DWB_TX_SHARPEN                      0x240
  49. #define DWB_TX_MODULATE_DETAIL              0x250
  50. #define DWB_TX_ADD_DETAIL                   0x260
  51. #define DWB_TX_TRILINEAR                    0x270
  52. #define DWB_TX_MIPMAP_QUADLINEAR            0x280
  53. #define DWB_TX_BICUBIC_GEQUAL               0x290
  54. #define DWB_TX_BICUBIC_LEQUAL               0x2a0
  55. #define DWB_TX_BILINEAR_GEQUAL              0x2b0
  56. #define DWB_TX_BILINEAR_LEQUAL              0x2c0
  57.  
  58. /* 
  59.  * Texture repeat modes
  60.  */
  61.  
  62. #define DWB_TX_REPEAT               0x301
  63. #define DWB_TX_CLAMP                0x302
  64. #define DWB_TX_SELECT               0x303
  65.  
  66. /*
  67.  * Texture internal format
  68.  */
  69.  
  70. #define DWB_TX_I_12A_4              0x610
  71. #define DWB_TX_IA_8                 0x620
  72. #define DWB_TX_RGB_5                0x630
  73. #define DWB_TX_RGBA_4               0x640
  74. #define DWB_TX_IA_12                0x650
  75. #define DWB_TX_RGBA_8               0x660
  76. #define DWB_TX_RGBA_12              0x670
  77. #define DWB_TX_RGB_12               0x680
  78. #define DWB_TX_I_16                 0x690
  79.  
  80. /*
  81.  * Texture external format
  82.  */
  83. #define DWB_TX_PACK_8               0x710
  84. #define DWB_TX_PACK_16              0x720
  85. #define DWB_TX_PIXMODE              0x3000
  86.  
  87. /*
  88.  * Decal modes
  89.  */
  90.  
  91. #define DWB_DECAL_BASE_FAST               4
  92. #define DWB_DECAL_BASE_HIGH_QUALITY       5
  93. #define DWB_DECAL_BASE_STENCIL            6
  94. #define DWB_DECAL_BASE_DISPLACE           7
  95.  
  96. /*
  97.  * Sequence modes
  98.  */
  99.  
  100. #define DWB_SEQ_CYCLE                     0
  101. #define DWB_SEQ_SWING                     1
  102.  
  103. /*========================================================================
  104.  *========================================================================
  105.  *
  106.  *                        PUBLIC functions
  107.  *
  108.  *========================================================================
  109.  *========================================================================*/
  110.  
  111.  
  112.  
  113.  
  114. extern pfNode    *pfdLoad_dwb ( char *_file );
  115.  
  116.  
  117.  
  118. /*========================================================================
  119.  *========================================================================
  120.  *
  121.  *                   constants & macros...
  122.  *
  123.  *========================================================================
  124.  *========================================================================*/
  125.  
  126. #define CLIP_RECALCULATE        01  /* recalculate the clip region every frame*/
  127. #define CLIP_INITIAL            02  /* only calculate a clip region once */
  128.  
  129. /*------------------------------------------------------*/
  130. /* Designer's Workbench Format Version 2.005 opcodes     */
  131. /*------------------------------------------------------*/
  132. #define DB_HEADER            6001    /* top level record    */
  133. #define DB_GROUP            6002    /* container node    */
  134. #define DB_SWITCH            6003    /* LOD            */
  135. #define DB_FACE                6005    /* poly/line/points/mesh*/
  136.         
  137. #define DB_VERTEX            6010    /* lowest level node    */    
  138. #define DB_CONSTRUCTION            6011    /* list of const. pts    */
  139. #define DB_PACKED_VERTEX        6012    /* packed colr-not index*/
  140.  
  141. #define DB_BSPLINE            6020
  142. #define DB_BSPLINE_KNOTS        6021
  143. #define DB_BSPLINE_CNTRL_PNTS        6022
  144.  
  145. #define DB_LIGHT_PT            6023    /* face light point     */
  146.  
  147. #define DB_ARC                          6024    /* arcs                 */
  148.  
  149. #define DB_COMMENT                6031    /* user comments    */
  150. #define DB_COLOR_TABLE            6032    /* file color table    */
  151. #define DB_VIEW_PARAMS            6033    /* viewing parameters    */
  152.  
  153. #define DB_NAME_STR            6040    /* dynamic length name    */
  154. #define DB_FONT_STR            6041    /* name of string font  */
  155. #define DB_STRING_STR            6042    /* string string     */
  156. #define DB_FILE_STR            6043    /* external file name    */
  157. #define DB_TEX_FILE_STR            6044    /* texture file name    */
  158.  
  159. #define DB_MATRIX            6049    /* static coord. system */
  160.  
  161. #define DB_REPLICATE            6060    /* not implemented yet    */
  162. #define DB_INSTANCE_REF            6061    /* define node as instanance */
  163. #define DB_INSTANCE_DEF            6062    /* define node as instanable */
  164. #define DB_EXTERNAL            6063    /* external             */
  165. #define DB_EOF_EXTERNAL            6064    /* make end of external */
  166.  
  167. #define DB_STRING            6080    /* dynamic string node     */
  168. #define DB_PAGE                6081    /* perspective page node*/
  169. #define DB_IMAGE            6082    /* 2D bitmap image node */
  170.  
  171. #define DB_PUSH                6090    /* push record        */
  172. #define DB_POP                6091    /* pop record        */
  173.  
  174. #define DB_LINESTYLE_TABLE        6120    /* linestyle palette    */
  175. #define DB_MATERIAL_TABLE          6122    /* material palette    */
  176. #define DB_TEXTURE_TABLE          6123    /* texture palette    */
  177. #define DB_LSOURCE              6124    /* lightsource defn.    */    
  178. #define DB_LMODEL              6125    /* lightmodel defn.    */    
  179. #define DB_TEXMAP              6126    /* polygon Tex map def - dwb specific  */
  180. #define DB_LASTREC              6126    /*value of greatest opcode rec*/
  181.  
  182.  
  183. /*------------------------------------------------------*/
  184. /* file unit types - all coords stored as floating point*/
  185. /* values.                        */
  186. /*------------------------------------------------------*/
  187. #define UT_METERS            0    /* most as in old-dwb     */
  188. #define UT_KILOMETERS            1    /* format         */
  189. #define UT_YARDS            2    
  190. #define UT_MILES            3
  191. #define UT_FEET                4
  192. #define UT_INCHES            5
  193. #define UT_NAUTICAL_MILES        8
  194. #define UT_CENTIMETERS            9
  195.  
  196.  
  197. /*------------------------------------------------------*/
  198. /* unit conversion values                */
  199. /*------------------------------------------------------*/
  200. #define NM_TO_METERS            1852.0    /* Assuming INTERNATIONAL naut. mile */
  201. #define MILES_TO_METERS            1609.344/* Assuming US STATUTE mile */
  202. #define YARDS_TO_METERS            0.9144
  203. #define    FEET_TO_METERS            0.3048
  204. #define INCHES_TO_METERS        0.0254  
  205. #define    KM_TO_METERS            1000.0
  206. #define    CM_TO_METERS            0.01
  207. #define    MM_TO_METERS            0.001
  208.  
  209.  
  210.  
  211. /*------------------------------------------------------*/
  212. /* drawstyle.. how to globally draw the    model If     */
  213. /* DS_SELECTIVE then group determines.    Some of these   */
  214. /* values are used in the drawstyle/movestyle variable    */
  215. /* in the HEADER & the drawstyle field in the GROUP.    */
  216. /* Others refer to the the drawType of a FACE node.    */
  217. /*------------------------------------------------------*/
  218.  
  219. /*----------------------------------------------*/
  220. /* drawstyle                    */
  221. /*----------------------------------------------*/
  222. #define DS_SOLID_BOTH_SIDES        0
  223. #define DS_SOLID            1
  224. #define DS_CLOSED_WIRE            2
  225. #define DS_OPEN_WIRE            3
  226. #define DS_POINTS            4
  227. #define DS_WIRE                5
  228. #define DS_WIRE_ON_MOVE            6
  229. #define DS_POINT_ON_MOVE        7
  230. #define DS_WIRE_OVER_SOLID        8
  231. #define DS_SELECTIVE            9
  232. #define DB_OMNIDIRECTIONAL 1
  233. #define DB_UNIDIRECTIONAL 2
  234. #define DB_BIDIRECTIONAL 3
  235.  
  236. /*------------------------------------------------------*/
  237. /* switch philosophies                    */
  238. /*------------------------------------------------------*/
  239. #define ST_DISTANCE            0
  240. #define ST_THRESHOLD            1
  241.  
  242.  
  243. /*------------------------------------------------------*/
  244. /* shading models available                */
  245. /*------------------------------------------------------*/
  246. #define SM_FLAT_NON_LIT            0
  247. #define SM_GOURAUD_NON_LIT        1
  248. #define SM_ILLUMINATED            2 /* material binding decides whether flat/gouraud */
  249. #define SM_SELECTIVE            3
  250.  
  251. /*------------------------------------------------------*/
  252. /* poly types.Poly could be a collection of points, open*/
  253. /* line or closed line primitive OR it could be a meshed*/
  254. /* primitive.                        */
  255. /*------------------------------------------------------*/
  256. #define PT_POLY                0
  257. #define PT_TMESH            1
  258. #define PT_QMESH            2
  259.  
  260. /*------------------------------------------------------*/
  261. /* zbuffer/backface/aa toggle defines            */
  262. /*------------------------------------------------------*/
  263. #define TS_GLOBAL_OFF            0
  264. #define TS_GLOBAL_ON            1
  265. #define TS_SELECTIVE            2
  266.  
  267. /*------------------------------------------------------*/
  268. /* background fill types.                */
  269. /*------------------------------------------------------*/
  270. #define BF_FLAT                0
  271. #define BF_INVERSE            1
  272. #define BF_SHADED            2
  273.  
  274. /*------------------------------------------------------*/
  275. /* string stuff                     */
  276. /*------------------------------------------------------*/
  277. #define ST_VECTOR            0
  278. #define ST_RASTER            1
  279. #define ST_POLYGON            2
  280.  
  281. #define LEFT_TO_RIGHT            0
  282. #define RIGHT_TO_LEFT            1    
  283. #define TOP_TO_BOTTOM            2    
  284. #define BOTTOM_TO_TOP            3
  285.  
  286. #define H_ALIGN_LEFT            0
  287. #define H_ALIGN_RIGHT            1
  288. #define H_ALIGN_CENTER            2
  289.  
  290. #define V_ALIGN_BOTTOM            0
  291. #define V_ALIGN_TOP            1
  292. #define V_ALIGN_CENTER            2
  293.  
  294. /*------------------------------------------------------*/
  295. /* Material binding types                 */
  296. /*------------------------------------------------------*/
  297. #define MB_LIGHTING_OFF            0
  298. #define MB_PER_GROUP            1
  299. #define MB_PER_FACE            2
  300. #define MB_PER_VERTEX            3
  301. #define MB_SELECTIVE            4
  302.  
  303. /*------------------------------------------------------*/
  304. /* vertex sort types                     */
  305. /*------------------------------------------------------*/
  306. #define TEXTURED_VERT            8 /* offset for texture variant */
  307. #define VT_FLAT_VERTEX            1    
  308. #define VT_SHADED_VERTEX        2
  309. #define VT_ILLUM_VERTEX            3
  310. #define VT_SHADED_ILLUM_VERTEX        4
  311. #define VT_TEXTURED_FLAT_VERTEX        VT_FLAT_VERTEX + TEXTURED_VERT
  312. #define VT_TEXTURED_SHADED_VERTEX     VT_SHADED_VERTEX + TEXTURED_VERT
  313. #define VT_TEXTURED_ILLUM_VERTEX    VT_ILLUM_VERTEX + TEXTURED_VERT    
  314. #define VT_TEXTURED_SHADED_ILLUM_VERTEX    VT_SHADED_ILLUM_VERTEX + TEXTURED_VERT    
  315.  
  316. /*------------------------------------------------------*/
  317. /* up vector                         */
  318. /*------------------------------------------------------*/
  319. #define X_UP                1
  320. #define Y_UP                2
  321. #define Z_UP                3
  322.  
  323. /*------------------------------------------------------*/
  324. /* Misc...                        */
  325. /*------------------------------------------------------*/
  326. #define DWB_MAX_MATERIALS               65
  327. #define DWB_MAX_TEXTURES        1024
  328. #define DWB_VLISTSIZE            2048    /* Chunk size of vertex lists */
  329. #define PACKED_COLOR_INDEX        3840    /* *special* index for cpack colored vertices */
  330. #define TEXTURE_NOT_FOUND        -3
  331.  
  332.  
  333.  
  334. /*========================================================================
  335.  *========================================================================
  336.  *
  337.  *             Designer's Workbench Version 2 Disk Records
  338.  *
  339.  *========================================================================
  340.  *========================================================================*/
  341.  
  342.  
  343.  
  344.  
  345. /*----------------------------------------------*/
  346. /* dwbOpcodeRec                    */
  347. /* store the record opcode & size of the follow */
  348. /* ing record. Size doesn't include the 4 byte  */
  349. /* dwb_OPCODE_REC.                */
  350. /*----------------------------------------------*/
  351.  
  352. typedef struct _dwbOpcodeRec
  353. {
  354.     short opcode;
  355.     short size;
  356. }dwbOpcodeRec;
  357.  
  358.  
  359.  
  360. /*----------------------------------------------*/
  361. /* dwbUserRec                    */
  362. /* convenience struct to hold  user data         */
  363. /* fields that can be stored in most of the     */
  364. /* node types.                    */
  365. /*----------------------------------------------*/
  366.  
  367. typedef struct _dwbUserRec
  368. {
  369.     int    ifields[2];        /* couple of ints -             */
  370.     float  ffields[2];        /* couple of floats for user's use.Saved*/
  371. }dwbUserRec;            /* and restored by dwb.            */
  372.  
  373.  
  374.  
  375. /*----------------------------------------------*/
  376. /* dwbHeader                    */
  377. /* top-level database struct for any model     */
  378. /* loaded                     */
  379. /*----------------------------------------------*/
  380.  
  381. typedef struct _dwbHeader
  382. {      
  383.     short units;        /* different unit types         */
  384.     short reserved;        /* spare                */
  385.  
  386.     float version;        /* file format revision            */
  387.     char lastrev[32];        /* time/date written to disk.        */
  388.  
  389.     short next_node_ids[6];    /* Ids to auto generate a new node name */
  390.                     /* order is group,switch,face,string,    */
  391.                     /* image & page.            */
  392.  
  393.     float bbox[6];        /* bbox of entire model... order is bx    */
  394.                     /* by, bz, lx, ly, lz            */
  395.  
  396.     short drawstyle;        /* how to (globally) draw this model     */
  397.     short movestyle;        /* How to (globally) draw the model when*/
  398.                     /* moving                */
  399.     short shademodel;        /* How to (globally) shade the model     */
  400.     short zbuffer;        /* global zbuffer state         */
  401.  
  402.     short backface;        /* global backface removal state     */
  403.     short concave;        /* global concave state         */
  404.  
  405.     struct 
  406.     {    
  407.         unsigned invalid_view_hint: 1; /* tell dwb to recalc the view */
  408.     unsigned sparebits: 31;    /* reserved for future use.        */
  409.     } flags;            /* 4 bytes bit-flags             */
  410.     
  411.     dwbUserRec udata;          /* user fields                 */
  412.     float spare[4];        /* reserved for future use.        */
  413.     short spare2;         /* reserved for future use.        */
  414.     
  415.     short color;        /* backround color index        */
  416.  
  417.     short material_binding;    /* how to globally use materials     */
  418.     short transparency;        /* global transparency on/off         */
  419.     
  420.     short texture;        /* global texture on/off         */
  421.     short up_axis;        /* y is up or z is up in the database    */
  422.     
  423.     int  spare4[46];
  424.  
  425. }dwbHeader;
  426.  
  427.  
  428.  
  429.  
  430.  
  431. /*----------------------------------------------*/
  432. /* dwbGridInfo                    */
  433. /* holds the info on a grid location etc    */
  434. /*----------------------------------------------*/
  435.  
  436. typedef struct _dwbGridInfo
  437.     short grid_on;        /* display it or not            */
  438.     short grid_zbuffer;        /* zbuffer the grid            */
  439.     short grid_draw_after;    /* draw it after the model geometry    */
  440.     short grid_snap;        /* snap to grid is on.            */
  441.     short grid_orientation;    /* XY,FACE etc                */
  442.     float grid_xmajor;        /* distance between major divisions in x*/
  443.     float grid_ymajor;        /* distance between major divisions in y*/
  444.     short grid_xminor;        /* num minor divs between major divs - x*/
  445.     short grid_yminor;        /* num minor divs between major divs - y*/
  446.     float grid_width;        /* real-world width of the entire grid  */
  447.     float grid_height;        /* real-world height of the entire grid */
  448.     float grid_pos[3];        /* position of the grid center in 3D    */
  449.     float grid_normal[3];    /* normal to plane of the grid.        */
  450.     float grid_mat[4][4];    /* orientation (rotation) matrix    */
  451.     float grid_rot;        /* not used                */
  452.     float grid_edge_pt1[3];    /* not used                */
  453.     float grid_edge_pt2[3];    /* not used                */
  454.     float grid_offset;        /* offset from "correct plane" along    */
  455.                     /* normal to plane.            */
  456. }dwbGridInfo;    
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463. /*----------------------------------------------*/
  464. /* dwbView                    */
  465. /* structure to store the view params etc so     */
  466. /* that the user can go back to them later.    */
  467. /*----------------------------------------------*/
  468.  
  469. typedef struct _dwbView
  470. {
  471.     float eye_p;        /* pitch angle                 */
  472.     float eye_r;        /* roll angle                 */
  473.     float eye_h;        /* yaw angle                 */
  474.     float eye_x;        /* eyepoint XYZ             */ 
  475.     float eye_y;
  476.     float eye_z;                 
  477.     float fov;            /* field of view             */
  478.     float near;            /* near clipping plane location     */
  479.     float far;            /* far clipping plane location         */
  480.     
  481.     float model_x;        /* model position normally at origin     */
  482.     float model_y;
  483.     float model_z;
  484.   
  485.     float mat[4][4];        /* quarernion transformation matrix     */
  486.     float quat[4];        /* quaternion direction         */
  487.         
  488.     float model_p;        /* components of matrix         */
  489.     float model_r;
  490.     float model_h;
  491.     
  492.     float cen_bx,cen_by,cen_bz;    /* display centroid region         */
  493.     float cen_lx,cen_ly,cen_lz;
  494.                     
  495.  
  496.     dwbGridInfo gridinfo;    /* grid parameters             */
  497.  
  498.     short auto_clipplanes;    
  499.     short background_clear_type;    /* 0 = BF_FLAT
  500.                            1 = BF_INVERSE
  501.                            2 = BF_SHADED */
  502.                            
  503.     short spare;                                   
  504.     float spare2[10];            /* future expansion */        
  505.     
  506. } dwbView;
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513. /*----------------------------------------------*/
  514. /* dwbColorTable                */
  515. /* This is the same as the old dwb color table  */
  516. /*----------------------------------------------*/
  517.  
  518. typedef struct _dwbColorTable
  519. {                        
  520.     short shaded [31][3];    /* brightest colors of 128 intensities    */    
  521.     short fixed [64][3];    /* fixed RGB values.            */
  522.     short overlay[16][3];    /* geometry with these colors use ovlays*/
  523.     short underlay[16][3];    /* use underlays            */
  524.     short spare [32][3];    
  525.     short spare2;        
  526. } dwbColorTable;
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533. /*----------------------------------------------*/
  534. /* dwbTexInfo                    */
  535. /* texture info ref FOR THIS FILE.        */
  536. /*----------------------------------------------*/
  537.  
  538. typedef struct _dwbTexInfo
  539. {  
  540.     short xsize;        /* x size of texture in texels         */
  541.     short ysize;        /* y size of texture in texels         */
  542.     short zsize;        /* number of texture components     */
  543.     short type;            /* RLE or varbatim             */
  544.  
  545.     float minfilter;          /* TX_POINT, TX_BILINEAR, etc etc     */
  546.     float magfilter;          /* TX_POINT, TX_BILINEAR  etc etc     */
  547.     
  548.     float wrap;               /* TX_REPEAT, TX_CLAMP, TX_SELECT     */
  549.     float wraps;              /* S only                 */
  550.     float wrapt;              /* T only                 */
  551.     float envtype;            /* texture environment             */
  552.     
  553.     int  spare [ 16 ];  
  554.  
  555. }dwbTexInfo;
  556.  
  557.  
  558. /*----------------------------------------------*/
  559. /* dwbExtTexInfo                    */
  560. /* extended texture info FOR THIS FILE.         */
  561. /* Supported only from V3.0 of the DWB format   */
  562. /*----------------------------------------------*/
  563.  
  564. typedef struct _dwbExtTexInfo
  565. {
  566.     /*----------------------------------------------------------*/
  567.     /* initial part of record is exactly the same as the old    */
  568.     /* record. The opcode will be the same. Based on record size*/
  569.     /* the user can read into the appropriate record.           */
  570.     /*----------------------------------------------------------*/
  571.  
  572.     /*------------------*/
  573.     /* BASIC TEX INFO   */
  574.     /*------------------*/
  575.  
  576.     short xsize;                    /* x size of texture        */
  577.     short ysize;                    /* y size of texture        */
  578.     short zsize;                    /* num of texture components*/
  579.     short type;                     /* RLE or varbatim          */
  580.  
  581.     float minfilter;                /* TX_POINT,TX_BILINEAR, etc*/
  582.     float magfilter;                /* TX_POINT,TX_BILINEAR  etc*/
  583.  
  584.     float wrap;                     /* TX_REPEAT, TX_CLAMP, etc */
  585.     float wraps;                    /* S only                   */
  586.     float wrapt;                    /* T only                   */
  587.     float envtype;                  /* texture environment      */
  588.  
  589.     /*------------------*/
  590.     /*  PROPERTY USAGE  */
  591.     /*------------------*/
  592.  
  593.     float version;                  /* DWB format version       */
  594.     struct
  595.     {
  596.     unsigned enabled: 1;        /* This texture is on       */
  597.     unsigned magfilter_split: 1;/* individual mag alpha/colr*/
  598.     unsigned wrap_split: 1;     /* individual S & T wrap    */
  599.     unsigned internal: 1;       /* internal image storage   */
  600.     unsigned external: 1;       /* external image storage   */
  601.     unsigned mipmap_filter: 1;  /* kernal filters           */
  602.     unsigned bicubic_filter: 1;
  603.     unsigned control_points: 1; /* for sharp/detail texture */
  604.     unsigned tile: 1;           /* tile into larger texture */
  605.  
  606.     unsigned detail: 1;         /* Texture is a detail tex  */
  607.     unsigned fast_define: 1;    /* GL will use user's array */
  608.     unsigned component_select: 1;
  609.  
  610.     unsigned sparebits: 20;     /* future info              */
  611.     }flags;
  612.  
  613.  
  614.     /*------------------*/
  615.     /*  NEW TEVDEF INFO */
  616.     /*------------------*/
  617.     float component_select;         /* use of 1,2 tex comp.     */
  618.     float envcolor[4];              /* TEV color                */
  619.  
  620.  
  621.     /*------------------*/
  622.     /*  NEW TEXDEF INFO */
  623.     /*------------------*/
  624.  
  625.     float magfilter_alpha;
  626.     float magfilter_color;
  627.  
  628.     float bicubic_filter[2];        /* affects BICUBIC min/mag  */
  629.     float mipmap_filter[8];         /* generate mipmap levels   */
  630.  
  631.     float internal;                 /* internal storage hint    */
  632.     float external;                 /* external image storage   */
  633.  
  634.     float control_points[4][2];     /* detail/sharpen controls  */
  635.     float control_clamp;
  636.  
  637.     float detail[5];                /* J,K,M,N,Scramble         */
  638.  
  639.     float tile[4];                  /* tile into the texture    */
  640.  
  641.     float spare [73];
  642. }dwbExtTexInfo;
  643.  
  644.  
  645.  
  646. typedef struct _dwbTexture
  647. {
  648.     char *name;
  649.     dwbExtTexInfo tex;
  650. }dwbTexture;
  651.  
  652.  
  653.  
  654. typedef struct _dwbMaterial
  655. {
  656.     float diffuse[3];
  657.     float ambient[3];
  658.     float shininess;
  659.     float specular[3];
  660.     float emissive[3];
  661.     float alpha;
  662.     float spare[2];
  663. }dwbMaterial;
  664.  
  665.  
  666.  
  667. /*----------------------------------------------*/
  668. /* dwbMatInfo                    */
  669. /* material info ref FOR THIS FILE.        */
  670. /*----------------------------------------------*/
  671.  
  672. typedef struct _dwbMatInfo
  673. {     
  674.     struct             /* bit-flag structures.            */
  675.     {    
  676.     unsigned sparebits: 32;    
  677.     }flags;
  678.  
  679.     dwbMaterial mat;
  680.     
  681.     int  spare5 [ 23 ];  
  682.  
  683. }dwbMatInfo;
  684.  
  685.  
  686.  
  687.  
  688.  
  689. /*----------------------------------------------*/
  690. /* dwbLSourceInfo                */
  691. /* light-source info ref FOR THIS FILE.        */
  692. /*----------------------------------------------*/
  693.  
  694. typedef struct _dwbLSourceInfo
  695. {     
  696.     struct 
  697.     {    
  698.     unsigned sparebits: 32;    
  699.     }flags;            /* bit-flag structure.            */
  700.     
  701.     float defn[15];        /* light-source defn.            */
  702.     
  703.     int  spare5 [ 12 ];  
  704.  
  705. }dwbLSourceInfo;
  706.  
  707.  
  708.  
  709.  
  710.  
  711. /*----------------------------------------------*/
  712. /* dwbLModelInfo                */
  713. /* light-model info ref FOR THIS FILE.        */
  714. /*----------------------------------------------*/
  715.  
  716. typedef struct _dwbLModelInfo
  717. {     
  718.     struct 
  719.     {    
  720.     unsigned sparebits: 32;    
  721.     }flags;            /* bit-flag structures.            */
  722.     
  723.     float defn[8];        /* light-model defn.            */
  724.     
  725.     int  spare5 [ 11 ];  
  726.  
  727. }dwbLModelInfo;
  728.  
  729.  
  730.  
  731.  
  732.  
  733. /*----------------------------------------------*/
  734. /* dwbLineStyle                 */
  735. /* texture info ref FOR THIS FILE.        */
  736. /*----------------------------------------------*/
  737.  
  738. typedef struct _dwbLineStyle
  739. {  
  740.     unsigned short lstyle;    /* linestyle index            */
  741.     short repeat;        /* lsrepeat factor.            */
  742.     
  743.     int  spare[2];
  744.  
  745. }dwbLineStyle;
  746.  
  747.  
  748.  
  749.  
  750.  
  751. /*----------------------------------------------*/
  752. /* dwbGroup                    */
  753. /* General container group - can parent anything*/
  754. /* except a HEADER. Special case of a group is  */
  755. /* when it defines a perspective viewport or a  */
  756. /* clip region.                    */
  757. /*                                              */
  758. /* This has changed since the 2.1 version.      */
  759. /* fields that were unused before have been     */
  760. /* renamed and are used and new fields have     */
  761. /* introduced, which are:                       */
  762. /* short surfaceType;       [old: short spare ] */
  763. /* unsigned road_object: 1; [old: didn't exist] */
  764. /* short decal_type;        [old: short spare2] */
  765. /* short seq_random;        [old: short spare3] */
  766. /*----------------------------------------------*/
  767.  
  768. typedef struct {    
  769.     unsigned perspective:1;    /* perspective group in page-group-ovl     */    
  770.     unsigned region_def:1;    /* viewport defined             */
  771.     unsigned clip_region: 1;/* mask region type             */
  772.     unsigned pages: 1;    /* has pages - not necessarily persp    */
  773.     unsigned renderGrp: 1;    /* grp is parent of at least 1 drawable */
  774.     unsigned decal: 1;    /* coplanar geometry group */
  775.     unsigned billboard: 1;    /* billboard geometry group */
  776.     unsigned sequence: 1;    /* sequence geometry group */
  777.     unsigned sparebits: 24;    
  778.     } Grp_flags;
  779.  
  780.  
  781.  
  782. typedef struct _dwbGroup
  783. {                 
  784.     short layer;         /* relative priority            */                
  785.     short color;        /* color index                */            
  786.     
  787.     short drawstyle;        /* draw this group (lines,solid etc)     */
  788.     short shademodel;        /* flat,gouraud etc             */
  789.  
  790.     short linestyle;        /* linestyle for this group.        */
  791.     short linewidth;        /* linewidth for this group.        */
  792.     
  793.     short fill_pattern;        /* not used.                */
  794.     short texture;        /* not used - texture defined by face    */
  795.  
  796.     float transparency;        /* 0.0 -> 1.0, 1.o is totally opaque.    */
  797.     
  798.     short material;        /* material palette index.        */
  799.     short use_group_color;    /* use group color rather than primitive*/
  800.     short use_group_dstyle;    /* use group dstyle or inherit global.    */
  801.  
  802.     short surfaceType;
  803.     
  804.  
  805.     float bbox[6];        /* bbox of entire model... order is lx    */
  806.                     /* bx, ly, by, lz, bz            */
  807.     
  808.     Grp_flags            grp_flags;
  809.  
  810.     struct             /* following flags take effect when     */
  811.     {                /* approp' graphics option is SELECTIVE */
  812.     unsigned zbuffer:1;    /* This group drawn with zbuffer TRUE    */        
  813.     unsigned backface:1;    /* This group drawn with backface TRUE    */    
  814.     unsigned texture: 1;    /* This group drawn with texture enabled*/        
  815.     unsigned aa_lines: 1;    /* switch on line aa for this group    */
  816.     unsigned aa_polys: 1;    /* not implemented            */
  817.     unsigned concave: 1;    /* This group drawn with concave TRUE    */         
  818.     unsigned displist: 1;    /* not implemented             */        
  819.     unsigned sparebits2: 25;    
  820.     }gfx_flags;
  821.     
  822.     struct             /* following flags have no visual effect*/
  823.     {                /* for real-time use only.        */
  824.     unsigned day_object:1;        
  825.     unsigned night_object:1;        
  826.     unsigned dusk_object:1;        
  827.     unsigned shadow_object: 1;        
  828.     unsigned terrain_object: 1;        
  829.     unsigned road_object: 1;
  830.     unsigned sparebits3: 26;    
  831.     }ig_flags;    
  832.  
  833.     float ll[3];        /* lower-left viewport/clip-region pt.    */
  834.     float ur[3];        /* upper-right viewport/clip-region pt.    */
  835.     float center[3];        /* not used.                */
  836.    
  837.     dwbUserRec udata;      /* user fields                 */
  838.  
  839.     short material_binding;    /* how to bind materials for this group */
  840.                     /* if mat-binding is SELECTIVE        */
  841.     short decal_type;           /* displace poly or stencil */
  842.     
  843.     unsigned int  packed_color;    /* use this color if the color index is    */
  844.                    /* 3840 - signifies direct color map    */
  845.  
  846.     short collapsed;        /* structure chart indicator */
  847.     short seq_mode;        /* 0 = cycle, 1 = swing */
  848.     float seq_time;        /* frame time */
  849.     float seq_speed;        /* sequence time */
  850.     short seq_nreps;        /* number of repeats */
  851.     short seq_bgn;        /* beging index */
  852.     short seq_end;        /* end index */
  853.     short seq_random;           /* randomly draw children */
  854.  
  855.     float spare5[4];        /* spare fields 4 bytes each */
  856.     
  857. }dwbGroup;
  858.  
  859.  
  860.  
  861.  
  862.  
  863.  
  864.  
  865. /*----------------------------------------------*/
  866. /* dwbPage                    */
  867. /* A 1 of many switch. Based on active-page ID    */
  868. /* Page is typically used to setup a perspective*/
  869. /* viewport for MFD (multi-function display)    */
  870. /*----------------------------------------------*/
  871.  
  872. typedef struct _dwbPage
  873. {            
  874.     short layer;                 
  875.     short color;                
  876.  
  877.     short pageid;
  878.     short spare;
  879.     
  880.     struct 
  881.     {
  882.     unsigned perspective:1;    /* TRUE if viewparms used         */
  883.     unsigned active:1;    /* TRUE if displayed             */
  884.     unsigned sparebits: 30;
  885.     } flags;
  886.                         
  887.     float fov;                
  888.     float aspect;            
  889.                 /* model orientation in the viewport     */
  890.     float pitch;            
  891.     float roll;                
  892.     float heading;            
  893.     float scale;            
  894.     float eyept[3];    
  895.     
  896.     float pgcen[3];        /* center of page geometry bbox        */
  897.     
  898.     dwbUserRec udata;        /* user HEADER-stored fields         */
  899.  
  900.     float azim;            /* lookat parameters             */
  901.     float elev;
  902.     float twist;
  903.     
  904.     unsigned int  packed_color;        /* use this color if the color index is    */
  905.                        /* 3840 - signifies direct color map    */
  906.     float spare2[6];
  907.     
  908. }dwbPage;
  909.  
  910.         
  911.  
  912.  
  913.  
  914.  
  915.  
  916. /*----------------------------------------------*/
  917. /* dwbSwitch                    */
  918. /* Either an additive LOD or switchable     */
  919. /* depending on distance to the eye.        */
  920. /*----------------------------------------------*/
  921.  
  922. typedef struct _dwbSwitch
  923. {    
  924.     short layer;         /* relative priority - not used        */
  925.     short spare;
  926.                 
  927.     short switchtype;        /* either distance or threshold     */    
  928.     short threshold;        /* switch in threshold value         */
  929.  
  930.     float switchin;        /* switchin (distance) value         */
  931.     float switchout;        /* switchout(distance) value         */
  932.  
  933.     float center[3];        /* center of LOD block            */        
  934.     
  935.     struct 
  936.     {    
  937.     unsigned sparebits: 32;    
  938.     }flags;
  939.     
  940.     dwbUserRec udata;          /* user  fields             */
  941.    
  942.     int  spare2[12];
  943.      
  944. }dwbSwitch;
  945.  
  946.  
  947.  
  948.  
  949.  
  950.  
  951.  
  952. /*----------------------------------------------*/
  953. /* dwbFace                    */
  954. /* Dwb Polygon primitive.A poy could be a     */
  955. /* colection of points, an open/closed wire, a  */
  956. /* poly with n verts or a mesh primitive.    */
  957. /*----------------------------------------------*/
  958.  
  959. typedef struct _dwbFace
  960. {
  961.     short layer;         /* relative priority - not used        */     
  962.     short color;        /* poly color index.            */    
  963.  
  964.     short numverts;        /* number of vertices in this poly    */
  965.     short ptype;            /* poly,tmesh or qmesh             */
  966.     
  967.     short linewidth;        /* for wire-drawn styles.        */    
  968.     short drawstyle;        
  969.     
  970.     short linestyle;        /* line palatte index            */
  971.     short back_color;        /* colour of backfaced poly */
  972.  
  973.     short texture;        /* texture palette index         */
  974.     short material;        /* not used - group defines.        */
  975.  
  976.     float ir;            /* not used.                */
  977.     
  978.     struct 
  979.     {            
  980.         unsigned vertColors: 1;    /* verts have different colors than poly*/
  981.     unsigned sparebits: 31;
  982.     } flags;
  983.     
  984.     dwbUserRec udata;          /* user HEADER-stored fields         */
  985.  
  986.     unsigned int  packed_color;    /* use this color if the color index is    */
  987.                    /* 3840 - signifies direct color map    */
  988.     float spare2[7];
  989.     
  990. }dwbFace;
  991.  
  992.  
  993. /*-----------------------------------------------*/
  994. /* dwbNewFace - from version 3.0, has additional */
  995. /* fields to take care detail texturing, light   */
  996. /* point size and so on...                       */
  997. /* size of the record is the same as the old one */
  998. /*-----------------------------------------------*/
  999.  
  1000.  
  1001. typedef struct _dwbNewFace {
  1002.     short layer;                /* relative priority - not used         */
  1003.     short color;                /* poly color index.                    */
  1004.  
  1005.     short numverts;             /* number of vertices in this poly      */
  1006.     short ptype;                /* poly, tmesh, qmesh, bspline, light_pt*/
  1007.  
  1008.     short linewidth;            /* for wire-drawn styles.               */
  1009.     short drawstyle;
  1010.  
  1011.     short linestyle;            /* line palatte index                   */
  1012.     short back_color;           /* colour of backfaced poly */
  1013.  
  1014.     short texture;              /* texture palette index                */
  1015.     short pntsize;              /* if ptype == LIGHTPOINT               */
  1016.  
  1017.     /* This is *VERY* important. This field (pntsize) is not used in    */
  1018.     /* the older versions though it's present in the name of material.  */
  1019.     /* To keep the loader simple, this new structure is used even while */
  1020.     /* loading older versions. The newer versions might use this field  */
  1021.     /* when the face type is LIGHTPOINT and they will address this field*/
  1022.     /* as given above.                                                  */
  1023.  
  1024.  
  1025.     float ir;                   /* infra-red, not used                  */
  1026.  
  1027.     struct {
  1028.       unsigned vertColors: 1;    
  1029.       unsigned intersection: 1; /* poly is part of a road intersection  */
  1030.       unsigned sparebits: 30;
  1031.     } flags;
  1032.  
  1033.     dwbUserRec udata;           /* user HEADER-stored fields            */
  1034.  
  1035.     unsigned int packed_color;  /* use this color if the color index is */
  1036.                 /* 3840 - signifies direct color map    */
  1037.  
  1038.     struct {
  1039.       unsigned road: 1;
  1040.       unsigned intersection: 1;
  1041.       unsigned sparebits: 30;
  1042.     } ig_flags;
  1043.  
  1044.     short colapsed;
  1045.     short detail_tex;           /* detail texture index                 */
  1046.  
  1047.     short surface_material_code;/* used by DFAD                         */
  1048.     short feature_id;           /* used by DFAD                         */
  1049.  
  1050.     short alt_texture;          /* ignored                              */
  1051.     short material;             /* ignored                              */
  1052.  
  1053.     float spare2[3];
  1054.   } dwbNewFace;
  1055.  
  1056.  
  1057.  
  1058. /*----------------------------------------------*/
  1059. /* dwbString                    */
  1060. /* Dynamic string primitive - could be raster or*/
  1061. /* vector.string value & font name follow dwb_    */
  1062. /* STRING record because both are dynamic     */
  1063. /* length.                    */
  1064. /*----------------------------------------------*/
  1065.  
  1066. typedef struct _dwbString
  1067. {   
  1068.     short layer;         /* relative priority - not used        */ 
  1069.     short type;            /* vector, raster, polygon         */
  1070.     short color;    
  1071.     
  1072.     struct             
  1073.     {        
  1074.     unsigned boldface:1;        
  1075.     unsigned slanted:1;        
  1076.     unsigned underline:1;        
  1077.     unsigned strikeout:1;        
  1078.     unsigned text_entry:1;    
  1079.     unsigned sparebits:27;    
  1080.     } flags;
  1081.     short linewidth;        /* vector pixel width             */
  1082.     
  1083.     float    vfont_width;    /* width multiplier             */
  1084.     float    vfont_height;    /* height multiplier             */
  1085.     float    vfont_exp;        /* expansion factor              */
  1086.     unsigned vfont_display;    /* justification,alignment etc         */
  1087.  
  1088.     short direction;        /* Left-to-right, right-to-left etc    */
  1089.     short horiz_alignment;    /* left, right,center             */
  1090.     short vert_alignment;    /* baseline, top, center         */
  1091.  
  1092.  
  1093.     float matrix[4][4];        /* vector orientation matrix         */
  1094.     float coords[3];        /* string origin in 3D database coords  */
  1095.  
  1096.     dwbUserRec udata;          /* user HEADER-stored fields         */
  1097.  
  1098.     unsigned int  packed_color;    /* use this color if the color index is    */
  1099.                    /* 3840 - signifies direct color map    */
  1100.     float spare[9];
  1101.     
  1102. }dwbString;
  1103.  
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111. /*----------------------------------------------*/
  1112. /* dwbImage                    */
  1113. /* render a 2D bit-mapped image - old fashioned */
  1114. /* (or non-texture machine) way of doing moving */
  1115. /* map displays.image filename follows dwb_IMAGE*/
  1116. /* structure (dynamic length)            */
  1117. /*----------------------------------------------*/
  1118.  
  1119. typedef struct _dwbImage
  1120.     short layer;         /* relative priority - not used        */ 
  1121.     short spare;
  1122.                 
  1123.     struct 
  1124.     {        
  1125.     unsigned sparebits:32;
  1126.     } flags;
  1127.                      
  1128.     float xzoom;        /* rectzoom factors            */            
  1129.     float yzoom;
  1130.     int xsize;            /* size in pixels             */                
  1131.     int ysize;    
  1132.     float coords[3];        /* 3D database coordinate         */    
  1133.  
  1134.     dwbUserRec udata;          /* user HEADER-stored fields         */
  1135.  
  1136.     int  spare2[14];
  1137.     
  1138. }dwbImage;
  1139.  
  1140.  
  1141.  
  1142.  
  1143.  
  1144. /*----------------------------------------------*/
  1145. /* dwbVertex                    */
  1146. /* all vertices in dwb have color - normal info */
  1147. /*----------------------------------------------*/
  1148.  
  1149. typedef struct _dwbVertex
  1150. {
  1151.     short spare;        /* not used                */        
  1152.     short color;        /* index into color_table         */
  1153.     float coords[3];        /* xyz position values             */
  1154.     float normal[3];
  1155.     float tex_coords[4];    /* texture coordinates             */
  1156. }dwbVertex;
  1157.  
  1158.  
  1159.  
  1160. /*----------------------------------------------*/
  1161. /* dwbPackedVertex                */
  1162. /* As above but contains packed color instead of*/
  1163. /* an index into the color table.        */
  1164. /*----------------------------------------------*/
  1165.  
  1166. typedef struct _dwbPackedVertex
  1167. {
  1168.     unsigned int  packed_color;    /* in cpack format            */
  1169.     float coords[3];        /* xyz position values             */
  1170.     float normal[3];
  1171.     float tex_coords[4];    /* texture coordinates             */
  1172. }dwbPackedVertex;
  1173.  
  1174.  
  1175.  
  1176. typedef struct _dwbInstanceDef
  1177. {
  1178.   short val;
  1179.   short spare;
  1180.  
  1181. } dwbInstanceDef;
  1182.  
  1183. typedef struct _dwbInstanceRef
  1184. {
  1185.   short val;
  1186.   short spare;
  1187.   float mat[4][4];
  1188. } dwbInstanceRef;
  1189.  
  1190.  
  1191. typedef struct _instRefList
  1192. {
  1193.   pfNode *node;
  1194.   dwbInstanceDef inst;
  1195.   struct _instRefList *next;
  1196. } instRefList;
  1197.  
  1198. typedef struct _refBeforeDefList
  1199. {
  1200.   pfNode *parent;
  1201.   dwbInstanceRef inst;
  1202.   struct _refBeforeDefList *next;
  1203. } refBeforeDefList;
  1204.  
  1205.  
  1206. typedef struct _treeStack
  1207. {
  1208.   pfNode *parent;
  1209.   pfNode *current;
  1210.   float     balance[2]; /*quadword align */
  1211. } treeStack;
  1212.  
  1213. #define STACKSIZE 25
  1214.  
  1215.  
  1216. typedef struct _groupValues
  1217. {
  1218.     int shading;
  1219.     int binding;
  1220.     int backface;
  1221.     int drawstyle;
  1222.     int zbuffer;
  1223.     int material;
  1224.     float alpha;
  1225.     int texture;
  1226.  
  1227. } groupValues;
  1228.  
  1229. #define VERTS_PER_LINE 256  /* only support lines up to 256 verts long */
  1230. typedef struct  _myLines
  1231. {
  1232.     int    numVerts;
  1233.     int       cbind;
  1234.     pfVec3 coords[VERTS_PER_LINE];
  1235.     pfVec3 norms [VERTS_PER_LINE];
  1236.     pfVec4 colors[VERTS_PER_LINE];
  1237.     struct _myLines *next;
  1238. } myLines;
  1239.  
  1240. /*----------------------------------------------*/
  1241. /* dwbGeoState                    */
  1242. /* some of the more widely changed render state */
  1243. /* info. This could also include fog, light     */
  1244. /* model etc                     */
  1245. /*----------------------------------------------*/
  1246.  
  1247. typedef struct _dwbGeoState 
  1248. {
  1249.     groupValues values;
  1250.     pfGeoState    *pfgs;
  1251.     pfdGeoBuilder *builder;
  1252.     myLines    *lineList;
  1253.     struct _dwbGeoState *next;
  1254. } dwbGeoState;            
  1255.  
  1256.  
  1257.  
  1258. /* structure that will contain the file to be loaded in memory */
  1259. /* and the pointers needed to access that data */
  1260. typedef struct MemPtr {
  1261.                             char *ptr;
  1262.                             int pos; /* offset from file */
  1263.                             int length; /* length of the file */
  1264. } memPtr;
  1265.  
  1266.  
  1267.  
  1268. /*----------------------------------------------*/
  1269. /* dwbFile                    */
  1270. /* runtime info and Performer sub-tree as the     */
  1271. /* file is being loaded.            */
  1272. /*----------------------------------------------*/
  1273.  
  1274. typedef struct _dwbFile
  1275. {
  1276.     char      fname[PF_MAXSTRING];
  1277.     memPtr       file;   /* copy of file in memory buffer */
  1278.     pfGroup     *root;
  1279.     dwbHeader      header;    
  1280.     float        colorTable[4224][3];    /* all shades available in RGB     */
  1281.     dwbMatInfo  *materialTable;
  1282.     pfMaterial  **materials;
  1283.     int      materialsRead;
  1284.     dwbTexture  *textureTable;
  1285.     int      texturesRead;
  1286.  
  1287.     instRefList *instList;        /* contains list of instance definitions */
  1288.     refBeforeDefList *refList;    /* contains list of instance references  */
  1289.                       /* before they have been defined         */
  1290.  
  1291.     dwbGeoState *gsList;   /*global list of ALL dwbGeoStates in this model */
  1292.     int          treeDepth;
  1293.     treeStack    *stack;
  1294.     int          stackDepth;
  1295.     float      unitChange;
  1296.     groupValues  currentGroup;       /* contains the values of the */   
  1297.                      /* most recently read group */
  1298.     float     spare[3];         /* quadword align */
  1299.     float     lodScale;             /*lod scale for externals */
  1300.     int      *pfTexIndex;        /* local mapping of tex indice into */
  1301.                                      /* global texture table */
  1302.  
  1303.     int          containsInstancing; /* set when an instance or link is set */
  1304.     int          refBeforeDef;   /* instances are referred before defined */
  1305.     int      insideExternal; /* set to indicate that an external is being */
  1306.                  /* processed */ 
  1307.     int          renderGroup;    /* set when the currentGroup is a */
  1308.                                  /* render group                   */
  1309. } dwbFile;
  1310.  
  1311. typedef struct _dwbMatrix
  1312. {
  1313.   float mat[4][4];
  1314. } dwbMatrix;
  1315.  
  1316.  
  1317. /*----------------------------------------------*/
  1318. /* dwbBSpline                                   */
  1319. /*----------------------------------------------*/
  1320.  
  1321. typedef struct _dwbBSpline
  1322. {
  1323.     int order;          
  1324.     int numKnots;        
  1325.     int drawCntrlPnts;
  1326.     short spare[2];
  1327.     float spare3[6];
  1328.  
  1329. }dwbBSpline;
  1330.  
  1331.  
  1332.  
  1333. /*----------------------------------------------*/
  1334. /* dwbArc                                        */
  1335. /*----------------------------------------------*/
  1336.  
  1337. typedef struct _dwbArc 
  1338. {
  1339.   float pfOrigin[3]; 
  1340.   float fStartAngle;
  1341.   float fEndAngle;
  1342.   float fRadius;
  1343.   float pfNormal[3];
  1344.   float matrix[4][4];
  1345.  
  1346.   short drawstyle;
  1347.   short layer;
  1348.   short color;
  1349.  
  1350.   short linewidth;
  1351.   short linestyle;
  1352.  
  1353.   struct {
  1354.     unsigned sparebits: 32;
  1355.   } flags;
  1356.  
  1357.   dwbUserRec udata;
  1358.  
  1359.   unsigned int packed_color;
  1360.  
  1361.   float spare2[8];
  1362. } dwbArc;
  1363.  
  1364.  
  1365. /*
  1366.  * Light point structures
  1367. */
  1368.  
  1369. /*----------------------------------------------------------------------*/
  1370. /* dwbLightPtRec                                                        */
  1371. /*----------------------------------------------------------------------*/
  1372. /* This is a special node of "additional" info. associated with the prev*/
  1373. /* read dwbfaceRec Node. That face was flagged as a bspline face. There */
  1374. /* will be 2 variable-length additional records following this one. one */
  1375. /* is the knots array and one is the control points array               */
  1376. /*                                                                      */
  1377. /*----------------------------------------------------------------------*/
  1378.  
  1379. typedef struct _dwbLightPt
  1380. {
  1381.     short ltype;                        /* light type as follows...     */
  1382.                                         /* 1  = RUNWAY                  */
  1383.                                         /* 2  = HIGH_INT_RUNWAY         */
  1384.                                         /* 3  = MED_INT_RUNWAY          */
  1385.                                         /* 4  = THRESHOLD_STROBE        */
  1386.                                         /* 5  = TOUCHDOWN               */
  1387.                                         /* 6  = CENTERLINE              */
  1388.                                         /* 7  = TAXIWAY_TURNOFF         */
  1389.                                         /* 8  = ALS                     */
  1390.                                         /* 9  = HIGH_INT_ALS            */
  1391.                                         /* 10 = MED_INT_ALS             */
  1392.                                         /* 11 = SEQUENCED_FLASHING      */
  1393.                                         /* 12 = ALSF_I                  */
  1394.                                         /* 13 = ALSF_II                 */
  1395.                                         /* 14 = SHORT_ALSF              */
  1396.                                         /* 15 = MED_ALSF                */
  1397.                                         /* 16 = RUNWAY_ALIGNMENT        */
  1398.                                         /* 17 = SHORT_ALS               */
  1399.                                         /* 18 = MED_ALS                 */
  1400.                                         /* 19 = LDIN                    */
  1401.                                         /* 20 = ODALS                   */
  1402.                                         /* 21 = VASI                    */
  1403.                                         /* 22 = VASI_3BAR               */
  1404.                                         /* 23 = TVASI                   */
  1405.                                         /* 24 = PAPI                    */
  1406.                                         /* 25 = THRESHOLD               */
  1407.                                         /* 26 = TAXIWAY                 */
  1408.                                         /* 27 = BEACON                  */
  1409.                                         /* 28 = OBSTRUCTION             */
  1410.                                         /* 29 = DISPLACED_THRESHOLD     */
  1411.                                         /* 30 = VEHICLE_FRONT           */
  1412.                                         /* 31 = VEHICLE_REAR            */
  1413.                                         /* 32 = CITY                    */
  1414.  
  1415.     short directionality;               /* 1 = omni directional         */
  1416.                                         /* 2 = uni directional          */
  1417.                                         /* 3 = bi directional           */
  1418.  
  1419.     short shape;                        /* 1 = single point             */
  1420.                                         /* 2 = straight string          */
  1421.                                         /* 3 = curved string            */
  1422.                                         /* 4 = random                   */
  1423.     short suppress_last_light;          /* dont draw last light (eg last*/
  1424.                                         /* light is first light in      */
  1425.                                         /* another string)              */
  1426.  
  1427.     float dir[3];                       /* normalized direction vector  */
  1428.     float lwidth;                       /* angle around vector          */
  1429.     float lheight;                      /* angle around vector          */
  1430.     float diam;                         /* diameter of the bulb         */
  1431.  
  1432.     double intensity;                   /* real world intensity -       */
  1433.                                         /* candelas ?                   */
  1434.     double intensity_variance;          /* ie along a string or with    */
  1435.                                         /* time                         */
  1436.  
  1437.     float calligraphic_priority;        /* 1.0 is please make this light*/
  1438.                                         /* pt node calligraphic         */
  1439.  
  1440.     float spare2[13];
  1441.  
  1442. }dwbLightPt;
  1443.  
  1444. typedef struct _dwbLightString
  1445. {
  1446.  
  1447.   float position[3];
  1448.   struct _dwbLightString *next;
  1449.  
  1450.   double qwa;
  1451.  
  1452. } dwbLightString;
  1453.  
  1454.  
  1455. /* The following macros have been implemented to have exactly the same */
  1456. /* functionality as fread & fseek but operate on a memory buffer instead */
  1457. /* of a file. This speeds up processing considerably at the expense of */
  1458. /* error checking on the number of bytes read. They should be used by any */
  1459. /* user defined callbacks to access the file structure */
  1460.  
  1461. #define  memRead(toPtr,size, nitems, filePtr) \
  1462. { \
  1463.   memcpy((toPtr),((filePtr)->ptr + (filePtr)->pos), (size) * (nitems)); \
  1464.   (filePtr)->pos += (size) * (nitems); \
  1465. }
  1466.  
  1467. #define memSeek(filePtr, offset, pos2) \
  1468. {\
  1469.   switch (pos2) { \
  1470.     case  SEEK_SET:   (filePtr)->pos = offset; break; \
  1471.     case  SEEK_CUR:   (filePtr)->pos += offset; \
  1472.                       break; \
  1473.   } \
  1474. }
  1475.  
  1476.  
  1477. int setUserFuncs(int type, int (func)(int type, void *rec,
  1478.                  pfNode *current, pfNode *parent, memPtr *ifp));
  1479.  
  1480. #ifdef __cplusplus
  1481. }
  1482. #endif
  1483.  
  1484. #endif /* __PFDWB_H__ */
  1485.  
  1486.  
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.